package com.terrynoya.fight.util
{
	import flash.geom.Rectangle;
	
	import spark.primitives.Rect;

	public class JSonRect
	{
		public function JSonRect()
		{
			
		}
		
		public static function parse(value:String):Rectangle
		{
			value = value.replace("{","").replace("}","");
			var arr:Array = value.split(" ");
			var x:int = getValue(arr[0]);
			var y:int = getValue(arr[1]);
			var width:int = getValue(arr[2]);
			var height:int = getValue(arr[3]);
			return new Rectangle(x,y,width,height);
		}
		
		private static function getValue(value:String):int
		{
			var sub:String = value.substr(value.indexOf(":")+1);
			return int(sub);
		}
	}
}